/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cc.altius.model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author sagar
 */
@XmlRootElement
@Entity
@Table(name = "master_zone")
@NamedQueries({
    @NamedQuery(name = "MasterZone.findAll", query = "SELECT m FROM MasterZone m"),
    @NamedQuery(name = "MasterZone.findByMasterZoneId", query = "SELECT m FROM MasterZone m WHERE m.masterZoneId = :masterZoneId"),
    @NamedQuery(name = "MasterZone.findByMasterZoneCode", query = "SELECT m FROM MasterZone m WHERE m.masterZoneCode = :masterZoneCode")})
public class MasterZone implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "MASTER_ZONE_ID")
    private Integer masterZoneId;
    @Column(name = "MASTER_ZONE_CODE")
    private String masterZoneCode;
    @JoinColumn(name = "CITY_ID", referencedColumnName = "CITY_ID")
    @ManyToOne(optional=true)
    private City cityId;
    @JoinColumn(name = "GEOGRAPHICAL_ZONE_ID", referencedColumnName = "GEOGRAPHICAL_ZONE_ID")
    
    @ManyToOne(optional=true)
    private GeographicalZone geographicalZone;

    public GeographicalZone getGeographicalZone() {
        return geographicalZone;
    }

    public void setGeographicalZone(GeographicalZone geographicalZone) {
        this.geographicalZone = geographicalZone;
    }
//    @OneToMany(mappedBy = "masterZoneId")
//    private List<Zone> zoneList;

    public MasterZone() {
    }

    public MasterZone(Integer masterZoneId) {
        this.masterZoneId = masterZoneId;
    }

    public Integer getMasterZoneId() {
        return masterZoneId;
    }

    public void setMasterZoneId(Integer masterZoneId) {
        this.masterZoneId = masterZoneId;
    }

    public String getMasterZoneCode() {
        return masterZoneCode;
    }

    public void setMasterZoneCode(String masterZoneCode) {
        this.masterZoneCode = masterZoneCode;
    }

    public City getCityId() {
        return cityId;
    }

    public void setCityId(City cityId) {
        this.cityId = cityId;
    }

//    public List<Zone> getZoneList() {
//        return zoneList;
//    }
//
//    public void setZoneList(List<Zone> zoneList) {
//        this.zoneList = zoneList;
//    }

    public String getMasterZoneDesc() {
        return this.masterZoneCode+"("+this.getCityId().getCityName()+")";
    }


    }
